import dayjs from 'dayjs';
import { RESPONSE_MESSAGE } from '@/config';

export const responseSucceess = <T = any>(
  data: T,
  message?: string
): Api.Common.Response<T> => {
  return {
    data,
    message: message || RESPONSE_MESSAGE.SUCCESS,
    status: 0,
    timestamp: dayjs().valueOf()
  };
};
export const responseError = <T = any>(
  data?: T,
  message?: string,
  status?: number
): Api.Common.Response<T> => {
  return {
    data,
    message: message || RESPONSE_MESSAGE.ERROR,
    status: status || -1,
    timestamp: dayjs().valueOf()
  };
};
